<?php
$this->breadcrumbs=array(
	Yii::t('app', 'Купоны')
	
);

$this->menu=array(
		array('label'=>Yii::t('app',
				'List Company'), 'url'=>array('index')),
		array('label'=>Yii::t('app', 'Create Company'),
				'url'=>array('create')),
			);

		Yii::app()->clientScript->registerScript('search', "
			$('.search-button').click(function(){
				$('.search-form').toggle();
				return false;
				});
			$('.search-form form').submit(function(){
				$.fn.yiiGridView.update('company-grid', {
data: $(this).serialize()
});
				return false;
				});
			");
		?>
<div class="title">
<h2> Управление&nbsp;"Купоны"</h2>

</div>

<?php //echo CHtml::link(Yii::t('app', 'Advanced Search'),'#',array('class'=>'search-button')); ?>
<div class="search-form2" >
<?php /*$this->renderPartial('_search',array(
	'model'=>$model,
 * 
));*/ 
 $this->renderPartial('_searchcup');
?>
</div>

<div class="content">
	<a href="<?= $this->createUrl('create'); ?>" class="button green medium" style="opacity: 0.7; "><?= Yii::t('app', 'Добавить запись') ?></a>
<a href="<?= $this->createUrl('mailer'); ?>" class="button green medium" style="opacity: 0.7; "><?= Yii::t('app', 'Рассылка акций') ?></a>
<a href="<?= $this->createUrl('bonus'); ?>" class="button green medium" style="opacity: 0.7; "><?= Yii::t('app', 'Бонусы') ?></a>
	
	<?php $this->widget('zii.widgets.grid.CGridView', array(
		'id'=>'company-grid',
		'dataProvider'=>$model->search(),
		'selectableRows'=>$model->count(),
		'ajaxUpdate'=>false,
		'itemsCssClass'=>'table',
		'columns'=>array(
			array(
       'class'=>'CCheckBoxColumn',
       'header'=>'',
      ),
			'id',
			array('name'=>'last_time','value'=>'date("d/m/Y",strtotime($data->last_time))'),
			'name',

			array(
				'class'=>'CButtonColumn',
				'template'=>'{update} {delete}',  
				'updateButtonUrl'=>'Yii::app()->controller->createUrl("update", array("id"=>$data->primaryKey))', 
				'updateButtonImageUrl'=>$this->path.'gfx/icon-edit.png',
				'deleteButtonImageUrl'=>$this->path.'gfx/icon-delete.png',
			),
		),
	)); ?>
</div>